import request from '@/axios/request';
import url from '@/axios/url';
const { mesUrl, adminUrl} = url();
// 导出url
export const exportUrl = `${mesUrl}wmsInTask/export`
// 获取详情
export function getInfo (id = '') {
  return request({
    url: `${mesUrl}wmsInTask/info/${id}`,
    method: 'get'
  })
}
//分页查询
export function getList (params = {}) {
  return request({
    url: `${mesUrl}wmsKtInTask`,
    method: 'get',
    params:{
      ...params,
      taskType:"1"
    },
  });
}
export function getListJc (params = {}) {
  return request({
    url: `${mesUrl}wmsKtInTask`,
    method: 'get',
    params:{
      ...params,
      taskType:"2",
      taskTypeList:"2,3,4"
    },
  });
}
//分页查询待入库数据
export function waitInTask (params = {}) {
  return request({
    url: `${mesUrl}wmsKtInTask/waitInTask`,
    method: 'get',
    params,
  });
}

export function createData (data = {}) {
  return request({
    url: `${mesUrl}wmsKtInTask/createData`,
    method: 'post',
    data,
  });
}
/*
* 特殊入库
* */
export function inStockSpecial (data = {}) {
  return request({
    url: `${mesUrl}wmsKtInTask/inStockSpecial`,
    method: 'post',
    data,
  });
}

//新增
export function rowCreate (data = {}) {
  return request({
    url: `${mesUrl}wmsInTask`,
    method: 'post',
    data,
  });
}
// 批量新增
export function rowBatchCreate (data = []) {
  return request({
    url: `${mesUrl}wmsInTask/batch`,
    method: 'post',
    data,
  });
}
//入库操作
export function wmsKtInTaskDetail (data = {}) {
  return request({
    url: `${mesUrl}wmsKtInTaskDetail`,
    method: 'post',
    data,
  });
}
export function wmsKtInTaskDetailBatch (data = {}) {
  return request({
    url: `${mesUrl}wmsKtInTaskDetail/batch`,
    method: 'post',
    data,
  });
}
//删除
export function rowDel (id) {
  return request({
    url: `${mesUrl}wmsInTask/${id}`,
    method: 'put',
  });
}
//下拉框字典等
// 查询单据类型 10采购入库20退料入库30生产入库40退货入库50其它入库列表


// 获取品牌信息
export function mesTmMaterialBrand (params = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialBrand/page`,
    method: 'get',
    params,
  });
}



export function getOrderTypeList () {
  return request({
    url: `${adminUrl}dict/type/wms_in_order_type`,
    method: 'get',
  });
}
export function getMaterialTypeList () {
  return request({
    url: `${adminUrl}dict/type/tm_material_base`,
    method: 'get',
  });
}
// 查询订单状态 10创建20入库中30完成列表
export function getOrderStatusList () {
  return request({
    url: `${adminUrl}dict/type/wms_in_order_status`,
    method: 'get',
  });
}
// 查询质检状态列表
export function getQualityInspectionStatusList () {
  return request({
    url: `${adminUrl}dict/type/quality_inspection_status`,
    method: 'get',
  });
}
// 查询erp状态列表
export function getErpStatusList () {
  return request({
    url: `${adminUrl}dict/type/wms_erp_status`,
    method: 'get',
  });
}
// 查询物料编码列表
export function getGoodsList (data = {}) {
  return request({
    url: `${adminUrl}baseGoods/list`,
    method: 'get',
    data,
  });
}


// 获取仓库信息
export function getCurrentWarehouseCode () {
  return request({
    url: `${adminUrl}basic`,
    method: 'get',
  });
}

// 查询物料编码列表
export function getSupplier (data = {}) {
  return request({
    url: `${adminUrl}commonSupplier/list`,
    method: 'get',
    data,
  });
}

// 根据单号获取展示详情
export function getInfoByOrderNo (id = "", flag = true) {
  return request({
    url: `${mesUrl}wmsKtInTask/info/${id}`,
    method: "get",
  });
}

// 查询单位列表
export function getUnitList () {
  return request({
    url: `${adminUrl}dict/type/units`,
    method: "get",
  });
}

//过账
export function rowAccount (id) {
  return request({
    url: `${mesUrl}wmsInTask/account/${id}`,
    method: "put",
  });
}

export function getAllowBatchAccounting () {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: 'get',
  });
}
